﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>HTML/URL 编解码工具</title>
    <style type="text/css">
body{font-size:9pt}
p{padding:0;margin:0}
h1{font-size:12pt}
h2{font-size:10pt}
td{padding:10px}
#tdact{width:240px}
#tdact input{width:100px;border:dashed 1px #999;padding: 0 3px}
    </style>
</head>
<body>
<h1>HTML/URL 编解码工具 (enc.xpus.net)</h1>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<p>待编码文本</p>
<textarea id="ti" rows="20" cols="30"></textarea>
</td>
<td id="tdact">
<div id="divp">
<div>
<p>编码（仅URL编解码时有效）：</p>
<select id="enc">
<option value="default">默认编码</option>
<option value="gb2312">简体中文（GB2312）</option>
<option value="big5">繁体中文（BIG5）</option>
<option value="utf-7">UTF-7</option>
<option value="utf-8">UTF-8</option>
<option value="utf-16">UTF-16</option>
<option value="utf-32">UTF-32</option>
</select>
</div>
<div>
<input type="button" value="URL编码 >>" onclick="sr('ue')" />
<input type="button" value="URL解码 >>" onclick="sr('ud')" /><br /><br />
<input type="button" value="HTML编码 >>" onclick="sr('he')" />
<input type="button" value="HTML解码 >>" onclick="sr('hd')" /><br />
</div>
</div>
<div id="divc" style="display:none;">
<p>正在请求...</p>
<input type="button" value="取消" onclick="cr()" />
</div>
</td>
<td>
<p>编解码结果</p>
<textarea id="to" rows="20" cols="30" readonly="readonly"></textarea>
</td>
</tr>
</table>
    <div>
<script type="text/javascript"><!--
google_ad_client = "pub-0410788977836329";
//728x90, 创建于 08-1-24
google_ad_slot = "8100466187";
google_ad_width = 728;
google_ad_height = 90;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
    </div>
	<div style="color:#999;font-size:8pt;margin-top:10px">
		&copy xpus.net, 2008. Powered by <a href="mailto:lyb.net@gmail.com?subject=About HTML/URL Codec Google Gadget">Anders Liu</a>.
	</div>
</body>
<script type="text/javascript">
var _msxml=["Microsoft.XMLHTTP","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"];

function cxhr(){
 var r;
 try{r=new XMLHttpRequest();}
 catch(e){
  for(var i=0;i<_msxml.length;++i){
   try{r=new ActiveXObject(_msxml[i]);break;}
   catch(e){}}}
 finally{return r;}
}

var x;
var divp=document.getElementById("divp");
var divc=document.getElementById("divc");

function rr(){
 var to=document.getElementById("to");
 if(x.readyState==4){if(x.status==200){
  to.value=x.responseText;
  divp.style.display="block";
  divc.style.display="none";
 }}
}

function sr(m){
 var ti=document.getElementById("ti");
 var enc=document.getElementById("enc");
 var r="m="+encodeURIComponent(m)+"&s="+encodeURIComponent(ti.value)+"&e="+encodeURIComponent(enc.value);
 divp.style.display="none";
 divc.style.display="block";
 x=cxhr();
 x.onreadystatechange=rr;
 x.open("POST","codec.ashx",true);
 x.send(r);
}

function cr(){
 if(x!=null){
   x.abort();
   divp.style.display="block";
   divc.style.display="none";}
}
</script>
</html>
